home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / XandSysPerf / Xperformance.text < prev    next >
Encoding:
Text File  |  1994-08-02  |  3.5 KB  |  97 lines

  1.        
  2.                          X Performance Considerations
  3.  
  4.    
  5.      o  Scalable Fonts, don't use them unless you are scaling them.
  6.         Otherwise use pre-built bitmap fonts.
  7.    
  8.      o  Avoid non-rectangular window clips.  Exposes involve more 
  9.         events;  rendering is less efficient.
  10.    
  11.      o  Avoid the SHAPE extension.  It complicates clip regions.
  12.    
  13.      o  Avoid asking for MotionNotify events on windows.  Wakes your 
  14.         client when pointer moves through your windows.
  15.    
  16.      o  Avoid backing store.
  17.    
  18.      o  Be careful about leaking pixmaps.  This ends up growing the 
  19.         X server's heap.
  20.    
  21.      o  Be aware of the small cost associated with GC validation costs. 
  22.         Example:
  23.    
  24.         /* GC validation per primative */
  25.         for(i=0;i<100;i++) {
  26.             DrawPrimitive(drawableA, GC);
  27.             DrawPrimitive(drawableB, GC);
  28.         }
  29.  
  30.         /* more efficient */
  31.         for(i=0;i<100;i++)
  32.             DrawPrimitive(drawableA, GC);
  33.         for(i=0;i<100;i++)
  34.             DrawPrimitive(drawableB, GC);
  35.    
  36.      o  Take advantage of Xlib's automatic poly-primitive request 
  37.         batching.  Example:
  38.    
  39.         for(i=0;i<100;i++)
  40.             XDrawLine(dpy,drawable,gc, x1[i],y1[i],x2[i],y2[i]);
  41.    
  42.         This become one PolySegement request.  
  43.         Rules:  Can't change drawable or gc;  
  44.                 can't interleave other requests.
  45.    
  46.      o  Be sure to compress expose events.  Toolkits normally do this 
  47.         for you.
  48.    
  49.      o  Use MapNotify and VisibilityNotify events to stop animation or 
  50.         continous screen update.
  51.    
  52.      o  Map child windows, then parent window.
  53.    
  54.      o  When doing CopyArea or CopyPlane from a drawable you know is a 
  55.         pixmap, be sure the GC has GCGraphicsExpose set to False.  
  56.         Otherwise you are generating useless NoExpose events.
  57.    
  58.      o  Understand XSync vs. XFlush.  XFlush makes sure all pending X 
  59.         requests are sent to X server for execution in finite time.  
  60.         XSync ensures all requests have been executed, forcing a 
  61.         round-trip.
  62.    
  63.      o  If you design benchmarks involving X, consider X latency.  
  64.         Measure how much work actually gets done, not how much work can 
  65.         be queued.  Use XSync to ensure benchmark completion.
  66.    
  67.      o  Don't use unnecessarily deep visuals;  image data and pixmaps 
  68.         need to be just as deep.
  69.    
  70.      o  Don't use Xlib, Xt, or Motif routines in a signal handler.  Set a 
  71.         global variable and get out.
  72.    
  73.      o  The X server is not an inter-process communication clearing house.
  74.         Properties, atoms, and selections are very inefficient for 
  75.         communicating data between clients.
  76.    
  77.      o  Use pixie's call counting to determine what X or Xt routines you 
  78.         are calling a lot.  Set dbx breakpoints; find out why.
  79.    
  80.      o  When changing cursor to busy cursor, let subwindows inherit new 
  81.         cursor from parents instead of changing the cursor for each window.
  82.    
  83.      o  X round-trip hit list.  Is there a good reason for calling these 
  84.         routines?
  85.    
  86.      XAllocColor            XGetModifierMapping    XQueryTree
  87.      XAllocColorCells       XGetWindowProperty     XSync
  88.      XAllocColorPlanes      XGetWindowAttributes   XTranslateCoordinates
  89.      XAllocNamedColor       XQueryFont             XInternAtom 
  90.      XGetAtomName           XQueryBestSize         XListFonts 
  91.      XGetGeometry           XQueryColor            XListFontsWithInfo
  92.      XGetKeyboardMapping    XQueryColors           
  93.      
  94.      
  95.      
  96.      
  97.